#!/bin/bash
netstat -na|grep "LISTEN"|grep "3306"|wc -l > /dev/null 2>&1
i=$?
ps aux | grep mysqld | grep -v grep > /dev/null 2>&1
j=$?
if [ $i = 0 ] && [ $j = 0 ]
then
  pkill keepalived
fi